package com.example.test02;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.example.test02.model.SysUser;

import org.apache.cxf.endpoint.Client;
import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;

import java.net.URL;
import java.util.List;

/**
 * @author jie
 * @date 2021/4/25 -15:25
 */
public class TestWS {
    public static void main(String[] args) {
        try{
            JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
            URL url= new URL("http://10.0.0.132:8081/wbs/ws/api?wsdl");
            Client client = dcf.createClient(url);
            Object[] objects = client.invoke("getList");
            String jsonStr = JSONObject.toJSONString(objects[0]);
            JSONArray array = JSONArray.parseArray(jsonStr);
            List<SysUser> sysUserList = JSONObject.parseArray(array.toJSONString(), SysUser.class);
            System.out.println(sysUserList);


        }catch(Exception e){
            e.printStackTrace();
            throw new RuntimeException(e);
        }
    }
}
